import { Router } from 'express';
import {
  getListeningMaterials,
  getListeningMaterial,
  createListeningMaterial,
  updateListeningMaterial,
  deleteListeningMaterial,
  getUserListeningRecords,
  createListeningRecord
} from '../controllers/listeningController';
import { authMiddleware } from '../middleware/authMiddleware';
import { adminMiddleware } from '../middleware/adminMiddleware';

const router = Router();

// 听力材料路由
router.get('/materials', getListeningMaterials);
router.get('/materials/:id', getListeningMaterial);
router.post('/materials', authMiddleware, adminMiddleware, createListeningMaterial);
router.put('/materials/:id', authMiddleware, adminMiddleware, updateListeningMaterial);
router.delete('/materials/:id', authMiddleware, adminMiddleware, deleteListeningMaterial);

// 听力练习记录路由
router.get('/records/:userId', authMiddleware, getUserListeningRecords);
router.post('/records', authMiddleware, createListeningRecord);

export default router; 